/*
 *Copyright © 2015 zhaorongbao
 *招融宝
 *http://zhaorongbao.com
 *All rights reserved.
 */
package com.hanhai.common.bizInterface;

import java.util.ArrayList;

import org.apache.commons.collections.CollectionUtils;

public class ChangeNotifyUtil {

	public final static void addListener(String subject, ChangeNotify item) {
		if (ChangeNotify.notifySubject.get(subject) == null) {
			ChangeNotify.notifySubject.put(subject,
					new ArrayList<ChangeNotify>());
		}
		ChangeNotify.notifySubject.get(subject).add(item);
	}

	public final static void notify(String subject,Object bizInfo) {
		if (CollectionUtils.isNotEmpty(ChangeNotify.notifySubject.get(subject))) {
			for (ChangeNotify notify : ChangeNotify.notifySubject.get(subject)) {
				notify.change(subject,bizInfo);
			}
		}

	}

}
